<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Handling of binary column data</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.odbc-binmode" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">odbc_binmode</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">odbc_binmode</span> &mdash; <span class="dc-title">Handling of binary column data</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.odbc-binmode-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>odbc_binmode</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$result_id</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Enables handling of binary column data. ODBC SQL types affected are
   <em>BINARY</em>, <em>VARBINARY</em>, and
   <em>LONGVARBINARY</em>.
  </p>
  <p class="para">
   When binary SQL data is converted to character C data, each byte
   (8 bits) of source data is represented as two ASCII characters.
   These characters are the ASCII character representation of the
   number in its hexadecimal form. For example, a binary
   <em>00000001</em> is converted to
   <em>&quot;01&quot;</em> and a binary <em>11111111</em>
   is converted to <em>&quot;FF&quot;</em>.
   <table class="doctable table">
    <caption><strong>LONGVARBINARY handling</strong></caption>
    
     <thead>
      <tr>
       <th>binmode</th>
       <th>longreadlen</th>
       <th>result</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td><strong><code>ODBC_BINMODE_PASSTHRU</code></strong></td>
       <td>0</td>
       <td>passthru</td>
      </tr>

      <tr>
       <td><strong><code>ODBC_BINMODE_RETURN</code></strong></td>
       <td>0</td>
       <td>passthru</td>
      </tr>

      <tr>
       <td><strong><code>ODBC_BINMODE_CONVERT</code></strong></td>
       <td>0</td>
       <td>passthru</td>
      </tr>

      <tr>
       <td><strong><code>ODBC_BINMODE_PASSTHRU</code></strong></td>
       <td>0</td>
       <td>passthru</td>
      </tr>

      <tr>
       <td><strong><code>ODBC_BINMODE_PASSTHRU</code></strong></td>
       <td>&gt;0</td>
       <td>passthru</td>
      </tr>

      <tr>
       <td><strong><code>ODBC_BINMODE_RETURN</code></strong></td>
       <td>&gt;0</td>
       <td>return as is</td>
      </tr>

      <tr>
       <td><strong><code>ODBC_BINMODE_CONVERT</code></strong></td>
       <td>&gt;0</td>
       <td>return as char</td>
      </tr>

     </tbody>
    
   </table>

  </p>
  <p class="para">
   If <span class="function"><a href="odbc_fetch_into.html" class="function">odbc_fetch_into()</a></span> is used, passthru means that an
   empty string is returned for these columns.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.odbc-binmode-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">result_id</code></dt>

     <dd>

      <p class="para">
       The result identifier.
      </p>
      <p class="para">
       If <code class="parameter">result_id</code> is <em>0</em>, the
       settings apply as default for new results.
       <blockquote class="note"><p><strong class="note">Note</strong>: 
        <span class="simpara">
         Default for <em>longreadlen</em> is <em>4096</em> and
         <code class="parameter">mode</code> defaults to
         <em>ODBC_BINMODE_RETURN</em>. Handling of binary long
         columns is also affected by <span class="function"><a href="odbc_longreadlen.html" class="function">odbc_longreadlen()</a></span>.
        </span>
       </p></blockquote>
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">mode</code></dt>

     <dd>

      <p class="para">
       Possible values for <code class="parameter">mode</code> are:
       <ul class="itemizedlist">
        <li class="listitem">
         <span class="simpara">
          <strong><code>ODBC_BINMODE_PASSTHRU</code></strong>: Passthru BINARY data
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>ODBC_BINMODE_RETURN</code></strong>: Return as is
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>ODBC_BINMODE_CONVERT</code></strong>: Convert to char and return
         </span>
        </li>
       </ul>
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.odbc-binmode-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>

</div></div></div></body></html>